import $ from 'jquery';
import Vue from 'vue';



var Translate = function(str, from, to, callback) {
	
	
	let postData = {
		sourceText: str,
		source: from,
		target: to
	};
	
	Vue.prototype.axios.post('/ws/sys/auth/translate', postData).then(response => {
		var ress = response.data;
		if(0 == ress.meta.code) {
			callback(ress.data.targetText);
		} else {
			Vue.prototype.$Message.warning('腾讯  翻译失败:' + ress.meta.message);
		}
	});
};
export default Translate;